<?php
	header("Content-Type: text/html;charset=utf-8");
	include("function/_nosql.php"); //
	include("function/function.php");
	
	$uid = chkstr(trim($_REQUEST['uid']));

	if(empty($uid)){
		echo erro("参数错误");
	}
	if(!is_numeric($uid)){
		echo erro("参数错误");
	}
	if(getNewsNums("kboy_user","uid=$uid") <1){
		echo erro("参数错误");
	}
	$news_sql = "select * from kboy_forum_map where uid=$uid order by map_year asc , id asc ";
	$news_rows = mysql_query($news_sql);
	$arr['username']= getUserNickName($uid);
	$i=0;
	while($news_rs = mysql_fetch_array($news_rows)){
	 $arr['data'][$i]['city'] = $news_rs['map_prov'].$news_rs['map_city'];
	 $arr['data'][$i]['msg'] = $news_rs['map_text'];
	 $return= file_get_contents("http://api.map.baidu.com/geocoder/v2/?address=".$news_rs['map_prov'].$news_rs['map_city']."&output=json&ak=54880bc151123d9c63f499234064935f");
	 $res = json_decode($return);
	 $arr['data'][$i]['lng'] = $res->result->location->lng;
	 $arr['data'][$i]['lat'] = $res->result->location->lat;
	 
	 $i++;
	}
	echo json_encode($arr);
?>